package com.panopset;

/**
 * A little something to allow all threads to cleanly shut down.
 *
 * (I just called it Zombie, instead of State, because I didn't want to conflict
 * with Thread.State, and plus it's 04:52 on a Saturday morning, so Zombie was
 * the first thing I thought of when thinking of something that could be active
 * or not.)
 *
 * @author Karl Dinwiddie
 *
 */
public final class Zombie {

    /**
     * Will be true for the life of the application. All threads should check
     * here to see if they should terminate (as well as their own terminating
     * logic if necessary).
     */
    private static boolean active = true;

    /**
     * Stop application. There is no restart, kills all threads.
     */
    public static void stop() {
        active = false;
    }

    /**
     * @return true if active.
     */
    public static boolean isActive() {
        return active;
    }

    /**
     * Prevent instantiation.
     */
    private Zombie() {
    }
}
